#!/bin/bash

#You can use these ANSI escape codes:
_CB="\033["
Black="${_CB}0;30m"
Red="${_CB}0;31m"
Green="${_CB}0;32m"
Brown="${_CB}0;33m"
Blue="${_CB}0;34m"
Purple="${_CB}0;35m"
Cyan="${_CB}0;36m"
Light_Gray="${_CB}0;37m"
Dark_Gray="${_CB}1;30m"
Light_Red="${_CB}1;31m"
Light_Green="${_CB}1;32m"
Yellow="${_CB}1;33m"
Light_Blue="${_CB}1;34m"
Light_Purple="${_CB}1;35m"
Light_Cyan="${_CB}1;36m"
White="${_CB}1;37m"
NC="\033[0m"


function gprint {
    printf "${Green}[+]${NC} : $*\n"
}


PLA="$(cat << EOF | python 
import sys
print(sys.platform[:5])
EOF
)"

gprint "test " $PLA

if [ ! -d ~/.oh-my-zsh ];then
   gprint  "to install zsh and oh-my-zsh first "
   exit 0
fi

gprint "load example to zsh"
cp example.zsh ~/.oh-my-zsh/custom/example.zsh

if [[ $PLA == "linux" ]];then
    notify-send "test ";
    if [ $? -ne  0 ];then
        sudo apt install -y  libnotify-bin 1>/dev/null
    fi
    sudo apt install -y redis-server;
    sudo apt install -y python3-pip
    sudo apt install -y mate-utils
    sudo apt install -y supervisor
else
    gprint "install notifier redis and screenshot "
    brew install terminal-notifier redis imgur-screenshot  1>/dev/null
fi

gprint "ssh key generate "
if [ ! -f ~/.ssh/id_rsa.pub ];then
	ssh-keygen -t rsa -P '' 
else
	cat ~/.ssh/id_rsa.pub
fi

gprint "install python file "
pip3 install . -U 

gprint "load zsh auto complete  "
mkdir -p  ~/.oh-my-zsh/plugins/fshare/ && \
       	cp _fshare ~/.oh-my-zsh/plugins/fshare/ && \
	sed -ie 's/ git/ git fshare/g'   ~/.zshrc ; 
if [ $? -eq 0 ];then
	gprint "install ok "
fi


source ~/.zshrc
